﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Logo.command
{
    public class RepeatCommand : Command
    {
        private int numberLoop;
        private Command command;

        public RepeatCommand(LogoDraw logo, int numberLoop, Command command)
        {
            this.logo = logo;
            this.numberLoop = numberLoop;
            this.command = command;
        }

        public override void Execute()
        {
            logo.AddLog("REPEAT " + numberLoop);
            for (int i = 0; i < numberLoop; ++i)
            {
                command.Execute();
            }
        }
    }
}
